package models
{
	import flash.events.MouseEvent;
	
	import mx.containers.Panel;
	import mx.controls.LinkButton;
	import mx.controls.Text;

	public class Actualite extends Panel
	{
		
		private var graphicInit:GraphicInitialiser;
		
		private function clickOnLink(event:MouseEvent):void{
			graphicInit.changerPage(event.target["data"]);
		}
		
		public function Actualite(title:String,link:String,value:String,caller:GraphicInitialiser)
		{
			super();
			
			this.graphicInit = caller;
			
			this.setStyle("Stylename","panelActu");
			this.setStyle("borderStyle","solid");
			this.setStyle("borderColor","#8B4848");
			this.setStyle("borderThickness","1");
			
			this.horizontalScrollPolicy = "off";
			
			this.width=200;
			this.height=140;
			
			var titleToShow:Title = new Title(title);
			this.addChild(titleToShow);
			
			var textToShow:Text = new Text();
			textToShow.text = value;
			textToShow.width = 190;
			this.addChild(textToShow);
			
			var bLink:LinkButton = new LinkButton();
			bLink.label = "En savoir plus";
			bLink.data = link;
			bLink.addEventListener(MouseEvent.CLICK,clickOnLink);
			this.addChild(bLink);
			
			
		}
		
	}
}